<template>
  <div>
    <van-overlay :show="lotteryShow" @click="closeLotteryShow">
      <div class="wrapper" @click.stop>
        <div class="main">
            <img class="gx_top" src="@/assets/images/gx.png" alt="">
            <div class="img">
              <img :src="/http/.test(formData.prizeImage) ? formData.prizeImage:baseUrl+formData.prizeImage " alt="">
            </div>
            <div class="name">
              {{ formData.prizeName }}
            </div>
            <div class="btn">
              <a @click="closeLotteryShow" href="javascript:void (0)">I got it!</a>
            </div>
        </div>
      </div>
    </van-overlay>
  </div>
</template>

<script >
import Vue from 'vue';
import { Icon,Tag,Overlay,Empty } from 'vant';


Vue.use(Tag);
Vue.use(Icon);
Vue.use(Overlay);
Vue.use(Empty);

export default {
  props:['lotteryShow','lotteryValue'],
  data(){
    return{
      formData:{},
      baseUrl:process.env.VUE_APP_API_ROOT
    }
  },
  methods:{
    closeLotteryShow(){
      this.$emit('closeLottery',true)
    }
  },

  watch:{
    lotteryShow(newValue,oldValue){
      if (newValue){
        this.formData = this.lotteryValue
      }
    }
  }
}
</script>

<style scoped lang="scss">
.wrapper {
  width: 100%;
  min-height: 100vh;
  background: none;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 10%;
  box-sizing: border-box;
  .main{
    width: 100%;
    min-height: 150px;
    background: #fff;
    padding: 3%;
    box-sizing: border-box;
    transform: translateY(-50%);
    border: 2vw solid #ffe69d;
    position: relative;
    border-radius: 4vw;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    .gx_top{
      position: absolute;
      height: 60px;
      top: -30px;
    }
    .img{
      margin-top: 20px;
      width: 100%;
      height: 80px;
      display: flex;
      justify-content: center;
      align-items: center;
      img{
        width: 80px;
        height: 80px;
        border-radius: 10px;
      }
    }
    .name{
      width: 100%;
      height: 30px;
      margin-top: 10px;
      text-align: center;
      color: #FFB800;
      font-size: 18px;
    }
    .btn{
      width: 100%;
      height: 30px;
      display: flex;
      justify-content: center;
      margin: 15px 0;
      a{
        display: flex;
        justify-content: center;
        align-items: center;
        width: 200px;
        height: 35px;
        border-radius: 12px;
        background: #FFB800;
        font-size: 14px;
        color: #fff;
      }
    }
  }
}
</style>
